<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<script type="text/javascript">
	$(function() {
		var str = "<tr><td></td></tr>";
		
		$("#tbodyOfDeal").append();
		$('#handleTaskForm').form({
			url : '${pageContext.request.contextPath}/apply/approve' ,
			onSubmit : function() {
				progressLoad();
				$("#approvalID").val(parent.$.modalDialog.aprroval);
				var isValid = $(this).form('validate');
				if (!isValid) {
					progressClose();
				}
				return isValid;
			},
			success : function(result) {
				progressClose();
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.handler.dialog('close');
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
	});
</script>
<div style="margin: 5px">
	<form id="handleTaskForm" method="post" enctype="multipart/form-data">
		<input id="approvalID" type="hidden" name="approval" value="" />
		<input id="taskID" type="hidden" name=taskId value="${id}"  />
		<input id="formID" type="hidden" name="formId" value="${formId}"  />
		<table cellspacing="0" cellpadding="3" border="1" style="width: 100%">
			<tbody id="tbodyOfDeal">
				<tr bgcolor="#398EB7">
					<td colspan="2"><font color="#ffffff">申请信息</font></td>
				</tr>
					<c:forEach var='field' items='${fields}'>
						<tr>
							<td>${field.description}</td>
							<td>
								<c:if test="${field.name == 'validateBox'}">
									<input disabled="disabled" value="${field.value}" name="${fieldsVar.description}" id="vv000" class="easyui-validatebox" data-options="required:true" />
								</c:if>
								<c:if test="${field.name == 'textarea'}">
									<textarea disabled="disabled" name="${fieldsVar.description}" rows="3" cols="70">"${field.value}"</textarea>
								</c:if>
								<c:if test="${field.name == 'datetimeBox'}">
									<input disabled="disabled" value="${field.value}" name="${fieldsVar.description}"  style="width:150px">
								</c:if>
								<c:if test="${field.name == 'comboBox'}">
									<select disabled="disabled" id="" class="easyui-combobox" name="${fieldsVar.description}" style="width:200px;">  
									    <option value="${field.value}">${field.value}</option>  
									</select> 
								</c:if>
							</td>
						</tr>
                    </c:forEach>
			</tbody>
		</table>
		<br> 
		<table cellspacing="0" cellpadding="3" border="1" style="width: 100%">
			<tbody>
				<tr bgcolor="#398EB7">
					<td colspan="2"><font color="#ffffff">审批信息</font></td>
				</tr>
				<tr style="text-align: center;height: 40px">
					<td style="width: 95%;height: 40px">
						<input id="" name="comment"  class="easyui-validatebox" data-options="required:true" style="height:30px;width:90%;"/>
					</td>
				</tr>
				<c:if test="${fn:length(outcomes) > 1}">
                    <tr>
                        <td>选择下一步:
                        	<select name="outcome">
                             <c:forEach var='well' items='${outcomes}'>
                              <option>${well}</option>
                             </c:forEach>
							</select>
                        </td>
                    </tr>
                </c:if>
			</tbody>
		</table>
	</form>
</div>